class SourceUser < ActiveRecord::Base
  belongs_to :user
  belongs_to :source
  validate :user_pass_combination
  def user_pass_combination
    unless Source.find(source_id).name.constantize.confirm_user(username, password)
      errors.add(:password, "Not valid user password combination") 
    end
  end
end
